package com.tjhzzx.danfossNiagaraCore.enums;

import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;

/**
 * @author Luc
 * @version 1.0
 * @date 2021-07-09 21:26
 */
public final class BPeriodType extends BFrozenEnum {
    public static final int DAY = 1;
    public static final int MONTH = 2;
    public static final int YEAR = 3;

    public static final BPeriodType day = new BPeriodType(1);
    public static final BPeriodType month = new BPeriodType(2);
    public static final BPeriodType year = new BPeriodType(3);

    public static final BPeriodType DEFAULT = month;

    public BPeriodType(int ordinal) {
        super(ordinal);
    }

    public static BPeriodType make(int ordinal) {
        return (BPeriodType) month.getRange().get(ordinal, false);
    }

    public static BPeriodType make(String tag) {
        return (BPeriodType) month.getRange().get(tag);
    }


    @Override
    public Type getType() {
        return TYPE;
    }

    public static final Type TYPE = Sys.loadType(BPeriodType.class);

}
